package p.sunmes.les.util;

import java.io.IOException;
import java.io.OutputStream;

public class DataEncodeOutputStream extends OutputStream {

	private int p;
	private OutputStream out;

	public DataEncodeOutputStream(OutputStream output) {
		out = output;
	}

	@Override
	public void write(int b) throws IOException {
		b = DataUtil.byte2UnsignInt(b);
		b = b - 0xF + p % 0xF;
		p++;
		out.write((byte) b);
	}

}
